// 事件环
let p = new Promise((resolve,reject)=>{
    reject();
    resolve();
});
p.then(()=>console.log('成功'),()=>console.log('失败'));

const promise = new Promise((resolve,reject)=>{
  console.log(1); //1
   resolve();
  console.log(2); //2
})
promise.then(()=>{
  console.log(3);
})

Promise.resolve(1)
.then(x=>x+1)
.then(x=>{throw new Error('My Error')})
.catch(()=>1)
.then(x=>x+1)
.then(x=>console.log(x))
.catch(console.error)

/*
1
2
失败
3
2
*/

// promise 中的链式调用如何中断?
// Promise.finally实现原理?
// promise有哪些缺点？ 还是不够直观
